package com.chixing.controller;

import com.chixing.Server.OrderServer;
import com.chixing.pojo.Order;
import com.chixing.pojo.Result;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/order")
public class OrderController {
    @Autowired
    private OrderServer orderServer;

    @PostMapping("/insert")
    public Result insert(@RequestBody Order order) {
        Boolean flag = orderServer.insert(order);
        if (flag) {
            return Result.success();
        }
        return Result.error("添加失败");
    }

    @GetMapping("/queryAllByLimit")
    public Result queryAllByLimit(@Param("start") int start,@Param("pageSize") int pageSize) {
        return Result.success(orderServer.queryAllByLimit(start, pageSize));
    }
}
